﻿using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;

namespace Db7
{
    public static class StringEx
    {
        public static string AfterLast(this string This, string search)
        {
            if (This == null) return null;
            int pos = This.LastIndexOf(search);
            if (pos == -1) return String.Empty;
            return This.Substring(pos + search.Length);
        }

        public static string Before(this string This, string search)
        {
            if (This == null) return null;
            int pos = This.IndexOf(search);
            if (pos == -1) return This;
            return This.Substring(0, pos);
        }
    }
}
